const Koa = require('koa')
const bodyParser = require('koa-bodyparser')



// const serverAdapter = require('./middleware/bull')

const app = new Koa()


const router = require('./router')

const errorHendler = require('./error/errorHendler')

// 注册队列
// app.use(serverAdapter.registerPlugin())

// 注册解析请求体中间件
app.use(bodyParser())
// 注册路由
app.use(router.routes()).use(router.allowedMethods())



// 错误抛出
app.on('error', errorHendler)

module.exports = app
